home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 15 / CU Amiga Magazine's Super CD-ROM 15 (1997)(EMAP Images)(GB)[!][issue 1997-10].iso / CUCD / Graphics / Gallery / Source / StatusWindow.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-07-15  |  1.7 KB  |  86 lines

  1. #include <stream.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5.  
  6. #include "GUICINCLUDE:GUIC_Text.hpp"
  7. #include "GUICINCLUDE:GUIC_Fillbar.hpp"
  8. #include "GUICINCLUDE:GUIC_Screen.hpp"
  9. #include "GUICINCLUDE:GUIC_Application.hpp"
  10.  
  11. #include "StatusWindow.hpp"
  12.  
  13. /*********************************************************************************************************/
  14.  
  15. StatusWindowC::StatusWindowC            (GUIC_ApplicationC &app, GUIC_ScreenC &screen) : GUIC_WindowC(-1,-1, 50,9)
  16. {
  17.     this->app         = &app;
  18.     this->screen    = &screen;
  19.     
  20.     message         = new GUIC_TextC     (1,1,48,2,"");
  21.     percent             = new GUIC_FillbarC    (1,4,48,4,0);
  22.     
  23.     message->setJustification (GUIC_Center);
  24.     
  25.     add ( message );
  26.     add ( percent );
  27.     
  28.     setTitle ("Gallery Status Window");
  29.     
  30.     app.addPrefs("StatusWindow", this);
  31. }
  32. StatusWindowC::~StatusWindowC            (VOID)
  33. {
  34.     cleanUp();
  35. }
  36.  
  37. /*********************************************************************************************************/
  38.  
  39. STRPTR    StatusWindowC::getMessage    (VOID)
  40. {
  41.     return    message->get();
  42. }
  43. VOID         StatusWindowC::setMessage    (STRPTR t)
  44. {
  45.     message->set(t);
  46. }
  47. VOID        StatusWindowC::setPercent    (ULONG i)
  48. {
  49.     percent->set(i);
  50. }
  51. BOOL        StatusWindowC::action            (GUIC_EventC &e)
  52. {
  53.     switch (e.id)
  54.         {
  55.         case GUIC_GadgetEvent:
  56.             return TRUE;
  57.             break;
  58.         case GUIC_OpenWindow:
  59.             percent->set(0);
  60.             message->set("");
  61.             return TRUE;
  62.             break;
  63.         case GUIC_CloseWindow: 
  64.             return TRUE;
  65.             break;
  66.         default:
  67.             cerr << "Got an event: " << e.id << endl;
  68.         }
  69.     
  70.     return FALSE;
  71. }
  72.  
  73. STRPTR    StatusWindowC::getClass        (VOID)
  74. {
  75.     return "StatusWindowC";
  76. }
  77.  
  78. /*********************************************************************************************************/
  79.  
  80. VOID        StatusWindowC::cleanUp        (VOID)
  81. {
  82.     delete message;
  83.     delete percent;
  84. }
  85.  
  86.